package main

import "fmt"

type mySum func(int, int) int

func sum(n1 int, n2 int) int {
	return n1 + n2
}

func sum2(n1, n2, n3 int) int {
	return n1 + n2
}

// 使用type自定义数据类型来简化定义
func myFunc(funcVar mySum, num1 int, num2 int) int {
	return funcVar(num1, num2)
}

func main() {
	a := sum
	b := sum2
	fmt.Println(myFunc(a, 1, 2))
	fmt.Println(myFunc(b, 1, 2))
}